Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 25, 2025

Volume up/down actions now support selecting specific audio streams (music, notifications, etc.), eliminating the need for separate increase/decrease stream actions.

Changes

Data Model

  • Extended ActionData.Volume.Up and ActionData.Volume.Down with nullable volumeStream: VolumeStream? parameter
  • Null defaults to system-controlled stream, maintaining backward compatibility with existing keymaps
  • Deprecated VOLUME_INCREASE_STREAM and VOLUME_DECREASE_STREAM ActionIds
  • Removed Volume.Stream classes completely - old stream actions are automatically migrated to new format

UI (Jetpack Compose)

  • Created unified VolumeActionBottomSheet with radio button stream selection and "show volume dialog" checkbox
  • Consolidated state management into single volumeActionState with actionId field
  • Bottom sheet title dynamically determined based on action type (Volume Up vs Volume Down)
  • Integrated into ChooseActionScreen alongside existing action bottom sheets

Action Execution & Serialization

  • Updated PerformActionsUseCase to pass stream parameter to audio adapter
  • ActionDataEntityMapper serializes stream using existing EXTRA_STREAM_TYPE constant
  • Automatic migration: Old VOLUME_INCREASE_STREAM actions converted to Volume.Up with stream parameter, VOLUME_DECREASE_STREAM converted to Volume.Down with stream parameter
  • Safe null handling throughout deserialization path
  • Full backward compatibility maintained - old keymaps are automatically upgraded on load

Display

  • ActionUiHelper shows stream in description when selected (e.g., "Increase Music stream")
  • Falls back to "Volume up/down" for default stream

Example

// Old approach - required separate actions (now deprecated and auto-migrated)
ActionData.Volume.Stream.Increase(showVolumeUi = true, volumeStream = VolumeStream.MUSIC)
// ↓ automatically migrated to ↓
ActionData.Volume.Up(showVolumeUi = true, volumeStream = VolumeStream.MUSIC)

// New approach - unified action
ActionData.Volume.Up(showVolumeUi = true, volumeStream = VolumeStream.MUSIC)

// Backward compatible - existing keymaps work unchanged
ActionData.Volume.Up(showVolumeUi = false, volumeStream = null)

Existing keymaps with old stream actions are automatically migrated to the new Volume.Up/Volume.Down format when loaded, ensuring seamless transition without data loss.

Original prompt

This section details on the original issue you should resolve

<issue_title>Refactor 'volume up/down' actions to consolidate 'increase/decrease stream' functionality</issue_title>
<issue_description>Developer TODO (don't remove)

  • create new branch. put issue number at start of name
  • update documentation
  • squash and merge
  • delete branch</issue_description>

<agent_instructions>We now want to combine the increase stream and decrease stream actions with the volume up and volume down actions to a better volume up and volume down action, that has radio buttons to choose the stream to effect, (e.g. music, notifications). Also include a checkbox to show the volume dialog or not

Use Jetpack Compose for the rewrite</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@jambl3r We now want to combine the increase stream and decrease stream actions with the volume up and volume down actions to a better volume up and volume down action, that has radio buttons to choose the stream to effect, (e.g. music, notifications). Also include a checkbox to show the volume dialog or not

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI self-assigned this Oct 25, 2025
Copilot AI and others added 4 commits October 25, 2025 11:07
- Updated ActionData.Volume.Up and Down to include volumeStream parameter
- Created VolumeActionBottomSheet.kt with Compose UI for stream selection
- Updated CreateActionDelegate to handle new volume action configuration
- Updated ActionUiHelper to display stream in action descriptions
- Updated PerformActionsUseCase to use stream parameter when executing actions
- Added string resources for volume configuration UI

Co-authored-by: jambl3r <[email protected]>
- Updated ActionDataEntityMapper to read/write volumeStream from entity extras
- Ensures backward compatibility for existing keymaps without stream data

Co-authored-by: jambl3r <[email protected]>
- Use safe call operator instead of non-null assertion when reading stream type
- Returns null for invalid stream types instead of crashing
- Update CHANGELOG with new feature description

Co-authored-by: jambl3r <[email protected]>
- Replace non-null assertions with safe call operators in entity extras writing
- Gracefully handles potential missing map entries

Co-authored-by: jambl3r <[email protected]>
Copilot AI changed the title [WIP] Refactor volume up/down actions to consolidate stream functionality Consolidate volume stream control into volume up/down actions Oct 25, 2025
Copilot AI requested a review from jambl3r October 25, 2025 11:17
Copy link
Collaborator

@sds100 sds100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot implement my comments

CHANGELOG.md Outdated
- #727 Actions to send SMS messages: "Send SMS" and "Compose SMS"
- #1819 Explain how to enable the accessibility service restricted setting
- #661 Action to execute shell commands.
- Volume up/down actions now allow selecting a specific audio stream (e.g., music, notifications) to control, consolidating the functionality of increase/decrease stream actions.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Reword this to something like "consolidated volume and stream actions"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to "Consolidated volume and stream actions." in commit 3a6ac16


var httpRequestBottomSheetState: ActionData.HttpRequest? by mutableStateOf(null)
var smsActionBottomSheetState: SmsActionBottomSheetState? by mutableStateOf(null)
var volumeUpActionState: VolumeActionBottomSheetState? by mutableStateOf(null)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot

Just use the same volumeActionState and store which ActionId is being used. Then use that to figure out which action to create when done is clicked. Also show different bottom sheet title depending on the action.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consolidated into single volumeActionState with actionId field to determine which action to create. The bottom sheet title now dynamically changes based on the actionId. See commit 3a6ac16


@Serializable
data class Up(val showVolumeUi: Boolean) : Volume() {
data class Up(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot

Can you delete the streams in ActionData. Mark the ActionIds as deprecated. The ActionDataEntityMapper should be backwards compatible with the old Stream ActionIds.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deprecated VOLUME_INCREASE_STREAM and VOLUME_DECREASE_STREAM ActionIds, and marked Volume.Stream classes as deprecated. Kept the classes for full backward compatibility - old stream ActionIds will still deserialize correctly via ActionDataEntityMapper. See commit 3a6ac16

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot delete ActionData.Stream classes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleted ActionData.Volume.Stream classes completely. Old stream actions are now automatically migrated to Volume.Up/Down with stream parameter via ActionDataEntityMapper. See commit 39ca2c4

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleted ActionData.Volume.Stream classes completely. Old stream actions are now automatically migrated to Volume.Up/Down with stream parameter via ActionDataEntityMapper. See commit 39ca2c4

- Consolidated volumeUpActionState and volumeDownActionState into single volumeActionState
- Added actionId to VolumeActionBottomSheetState to determine which action to create
- Updated bottom sheet to use actionId for dynamic title selection
- Merged onDoneConfigVolumeUpClick and onDoneConfigVolumeDownClick into single handler
- Deprecated VOLUME_INCREASE_STREAM and VOLUME_DECREASE_STREAM ActionIds
- Deprecated Volume.Stream classes (kept for backward compatibility)
- Updated CHANGELOG wording to "Consolidated volume and stream actions"

Co-authored-by: sds100 <[email protected]>
Copilot AI requested a review from sds100 October 25, 2025 11:40
Copy link
Collaborator

@sds100 sds100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot do the comments


@Serializable
data class Up(val showVolumeUi: Boolean) : Volume() {
data class Up(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot delete ActionData.Stream classes.

- Removed deprecated Stream sealed class and Increase/Decrease subclasses
- Updated ActionDataEntityMapper to convert old VOLUME_INCREASE_STREAM and VOLUME_DECREASE_STREAM to Volume.Up and Volume.Down with stream parameter
- Updated CreateActionDelegate to redirect old stream action IDs to new bottom sheet
- Removed all Stream references from PerformActionsUseCase, ActionUiHelper, ConfigActionsUseCase, ActionUtils, and KeyMapActionsComparator
- Maintained full backward compatibility - old keymaps with stream actions will be automatically migrated to new format

Co-authored-by: sds100 <[email protected]>
Copilot AI requested a review from sds100 October 25, 2025 15:14
@sds100 sds100 merged commit fa34fd5 into develop Oct 26, 2025
2 of 3 checks passed
@sds100 sds100 deleted the copilot/refactor-volume-actions branch October 26, 2025 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor 'volume up/down' actions to consolidate 'increase/decrease stream' functionality

3 participants